﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SmartMedicalCare.API.Read.Applications.Commands;
using SmartMedicalCare.API.Read.Applications.Commands.科室;
using SmartMedicalCare.API.Read.DTO.科室DTO;
using SmartMedicalCare.Domain;
using SmartMedicalCare.ErronCode;
using System.Diagnostics;

namespace SmartMedicalCare.API.Read.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ManagementController : ControllerBase
    {
        private readonly IMediator mediator;

        public ManagementController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 登录方法
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<APIResult<UserModel>> Login(LoginCommand command)
        {
            return mediator.Send(command);
        }
        /// <summary>
        /// 轮播图显示方法
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<APIPaging<CarouselModel>>> CarouselShow([FromQuery] QueryCarouselCommand command)
        {
            return mediator.Send(command);
        }
        /// <summary>
        /// 科室显示接口
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<APIPaging<DepartmentModel>>> DepartmentShow([FromQuery] QueryDepartmentCommand command)
        {
            return mediator.Send(command);
        }
        /// <summary>
        /// 科室下拉框
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<List<SelectDTO>>> SelectShow()
        {
            QuerySelectCommand command=new QuerySelectCommand();
            return mediator.Send(command);
        }
        /// <summary>
        /// 二级科室显示接口
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<APIPaging<DeptSubCategoryModel>>> DeptSubCategoryShow([FromQuery] QueryDepartmentTowCommand command)
        {
            return mediator.Send(command);
        }

        /// <summary>
        /// 医院显示接口
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<APIPaging<HospitalModel>>> HospitalShow([FromQuery] QueryHospitalCommand command)
        {
            return mediator.Send(command);
        }


    }
}
